{% extends 'base.html' %}
{% block title %}执行States编排{% endblock %}

{% block content %}
<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header">执行States编排</h3>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <ul class="nav nav-tabs">
                <li><a href="/saltstack/key_list/">minion认证管理</a>
                </li>
                <li><a href="/saltstack/match_arg/">生成minion匹配值</a>
                </li>
                <li><a href="/saltstack/minion_service_start_html/">管理minion服务</a>
                </li>
                <li><a href="/saltstack/minion_install_html/">自动化部署minion</a>
                </li>
                <li><a href="/saltstack/cmd_exec_html/">执行系统命令</a>
                </li>
                <li class="active"><a href="/saltstack/state_exec_html/">执行States编排</a>
                </li>
            </ul>

            <div class="tab-content">
                <div class="tab-pane fade in active">
                    <div class="row">
                    <br>
                        <form action="/saltstack/state_exec/" method="get" role="form">
                        <div class="col-lg-3">
                            <ul>
                            <div class="form-group">
                                <label style="color: green">输入远程IP：</label>
                                <input class="form-control" name="ip_list" placeholder="多个IP以逗号分隔">
                    <!--<label style="color: green">输入模块名称：</label>
                    <input class="form-control" name="exec_module">-->
                                <label style="color: green">输入state名称：</label>
                                <input class="form-control" name="state_args">
                                <input class="btn btn-primary btn-xs" type="submit" value="执行">
                            </div>
                            </ul>
            <!--<button class="btn btn-primary btn-xs" type="submit">测试</button>-->
                        </div>
                        <div class="col-lg-1"></div>
                        <div class="col-lg-8">
                            <ul>
                            <div class="form-group">
                                <label style="color: green">执行结果：</label>
                                <textarea rows="18" style="background-color: black;color: green" class="form-control">{% for key, value in state_exec_result.items %}
{{ key }}:
-------------------------{% for i in value.values %}
Comment:    {{ i.comment }}
Result:         {{ i.result }}
Pid:            {{ i.changes.pid }}
Retcode:        {{ i.changes.retcode }}
stderr:         {{ i.changes.stderr }}
stdout:
{{ i.changes.stdout }}
-------------------------{% endfor %}
#####################################################################
{% endfor %}</textarea>
                            </div>
                            </ul>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}